package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.FileService;
import com.atguigu.spzx.model.vo.common.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author LT
 * @create 2024-03-13-20:47
 */
@RestController
@Tag(name = "文件管理模块")
@RequestMapping("/admin/system/file")
public class FileController {

    @Resource
    FileService fileService;

    @PostMapping("/upload")
    public Result upload(MultipartFile file,String module){
        String path = fileService.upload(file,module);
        return Result.ok(path);
    }

    @DeleteMapping("/delete")
    public Result deleteFile(String path){
        fileService.deleteFile(path);
        return  Result.ok();
    }



}
